using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class LevelTitleText : MonoBehaviour
{
    TMP_Text text;
    Coroutine close;
    // Start is called before the first frame update
    void Start()
    {
        text = GetComponent<TMP_Text>();
        gameObject.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void SetText(string text)
    {
        gameObject.SetActive(true);
        this.text.text = text;
        close = StartCoroutine(Close());
    }

    IEnumerator Close()
    {
        yield return new WaitForSeconds(1.0f);
        gameObject.SetActive(false);
        StopCoroutine(close);
    }
}
